package edu.kit.aifb.ldstream.stat.distrib;

import java.io.Serializable;

public class DiscreteUniformDistribution implements IDistribution, Serializable {

	private static final long serialVersionUID = 7967381027017208500L;

	private double max;
	private double min;
	
	public DiscreteUniformDistribution(double min, double max) {
		this.max = max;
		this.min = min;
	}
	
	/**
	 * @return the max
	 */
	public double getMax() {
		return max;
	}
	
	

	public double getMin() {
		return min;
	}

	@Override
	public int getDistributionType() {
		return IDistribution.UNIFORM_DISCRETE;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder(" DiscreteUniformDistribution with ");
		sb.append("max: ");
		sb.append(this.max);
		return sb.toString();
	}
	
	public boolean equals(Object o){
		if(o instanceof DiscreteUniformDistribution){
			DiscreteUniformDistribution dud = (DiscreteUniformDistribution) o;
			return Math.abs(this.max - dud.max) < 0.01d;
		}
		return false;
	}
	
	public int hashCode(){
		return (int) (this.max * 100000);
	}
}
